import datetime

def transFormTime_yyyymmddhhmmss():
     now = datetime.datetime.now()
     dateS = datetime.datetime.strftime(now, "%Y-%m-%d %H:%M:%S")
     return dateS
def transFormTime_yyyymmdd():
     now = datetime.datetime.now()
     dateS = datetime.datetime.strftime(now, "%Y-%m-%d")
     return dateS
# 距离现在时间差
def transFormTime_distanceFromNow(time_str):
    now = datetime.datetime.now()
    date1 = datetime.datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S")
    delta = now - date1
    days = delta.days
    hours = delta.seconds // 3600
    minutes = (delta.seconds // 60) % 60 / 60.0
    total_time = round((hours + minutes), 2)
    str_total_time = str(days) + "天" + str(total_time) + "小时"
    print('距离此时间：' + str_total_time)
    return str_total_time
# print(transFormTime_yyyymmddhhmmss())
# transFormTime_distanceFromNow('2024-01-26 08:30:00')